<template>
  <div class="bg">
    <div :class="['pc',isMobile ? 'mobile' : '']">
      <Sign :type="type" v-if="isSign" @handleSign='handleSign' />
      <Answer v-if="!isSign" :id='id' @handleSubmit='handleSubmit'/>
    </div>
  </div>
</template>

<script>
import Sign from "./sign.vue"
import Answer from "./answer.vue"

export default {
  name: 'activity',
  props: {},
  components: {
    Sign,
    Answer
  },
  data() {
    return {
      isMobile: false,
      isSign:true,
      type: 1
    }
  },
  computed: {},
  watch: {},
  methods: {
    getIsMobile(){
			if((navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i))) {
				return true
			}else {
				return false
			}
		},
    handleSign(id) {
      this.id = id
      this.isSign = false
    },
    handleSubmit() {
      this.isSign = true
    }
  },
  created() {
    this.type = Number(this.$route.query.type)
    this.isMobile = this.getIsMobile()
  },
  mounted() {
    
  },
  beforeCreate() {},
  beforeMount() {},
  beforeUpdate() {},
  updated() {},
  beforeDestroy() {},
  destroyed() {},
  activated() {},
}
</script>

<style lang='scss' scoped>
@import "~@/styles/codeFun.scss";
  .bg {
    @include flex-center;
    width: 100%;
    height: 100%;

    .pc {
      width: 500px;
      border: 1px solid lightgray;
    }
    .mobile {
      width: 100% !important;
    }
  }
  
</style>